home *** CD-ROM | disk | FTP | other *** search
- #ifndef MGET_LISTVIEW2_C
- #define MGET_LISTVIEW2_C
-
-
- /*
- * Source machine generated by GadToolsBox V2.0b
- * which is (c) Copyright 1991-1993 Jaba Development
- *
- * GUI Designed by : Jeremy Friesner
- */
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/imageclass.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <string.h>
-
- #include "mget_listview2.h"
-
- extern struct List *filelist;
- extern struct List *getlist;
-
- struct Screen *Scr = NULL;
- APTR VisualInfo = NULL;
- struct Window *mgetWnd = NULL;
- struct Gadget *mgetGList = NULL;
- struct Menu *mgetMenus = NULL;
- struct IntuiMessage mgetMsg;
- struct Gadget *mgetGadgets[2];
- UWORD mgetLeft = 0;
- UWORD mgetTop = 13;
- UWORD mgetWidth = 682;
- UWORD mgetHeight = 434;
- UBYTE *mgetWdt = (UBYTE *)"Loading....";
-
- UWORD lastcode;
-
- struct TextAttr topaz8 = {
- ( STRPTR )"topaz.font", 8, 0x00, 0x00 };
-
- struct NewMenu mgetNewMenu[] = {
- NM_TITLE, (STRPTR)"Project", NULL, 0, NULL, NULL,
- NM_ITEM, (STRPTR)"About", (STRPTR)"A", NULL, 0L, (APTR)mgetabout,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)"Quit", (STRPTR)"Q", 0, 0L, (APTR)mgetquit,
- /* NM_TITLE, (STRPTR)"Edit", NULL, 0, NULL, NULL,
- NM_ITEM, (STRPTR)"Copy", (STRPTR)"C", NM_ITEMDISABLED, 0L, (APTR)mgetcopy,
- NM_ITEM, (STRPTR)"Cut", (STRPTR)"X", NM_ITEMDISABLED, 0L, (APTR)mgetcut,
- NM_ITEM, (STRPTR)"Paste", (STRPTR)"V", NM_ITEMDISABLED, 0L, (APTR)mgetpaste,
- */ NM_END, NULL, NULL, 0, 0L, NULL };
-
- UWORD mgetGTypes[] = {
- LISTVIEW_KIND,
- LISTVIEW_KIND
- };
-
- struct NewGadget mgetNGad[] = {
- 2, 16, 670, 248, (UBYTE *)"Selectable Files", NULL, GD_listviewgadget, PLACETEXT_ABOVE, NULL, (APTR)listviewgadgetClicked,
- 2, 267, 670, 154, (UBYTE *)"Selected Files", NULL, GD_list2, PLACETEXT_BELOW, NULL, (APTR)list2Clicked
- };
-
- ULONG mgetGTags[] = {
- (GTLV_ShowSelected), NULL,
- (GT_Underscore), '_',
- (TAG_DONE),
- (TAG_DONE)
- };
-
- UWORD DriPens[] = {
- ~0 };
-
- int SetupScreen( void )
- {
- if ( ! ( Scr = OpenScreenTags( NULL, SA_Left, 0,
- SA_Top, 0,
- SA_Width, 682,
- SA_Height, 458,
- SA_Depth, 2,
- SA_Font, &topaz8,
- SA_Type, CUSTOMSCREEN,
- SA_DisplayID, NTSC_MONITOR_ID|HIRESLACE_KEY,
- SA_AutoScroll, TRUE,
- SA_Overscan, OSCAN_TEXT,
- SA_Pens, &DriPens[0],
- SA_Title, "MGET generator Screen",
- TAG_DONE )))
- return( 1L );
-
- if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
- return( 2L );
-
- return( 0L );
- }
-
- void CloseDownScreen( void )
- {
- if ( VisualInfo ) {
- FreeVisualInfo( VisualInfo );
- VisualInfo = NULL;
- }
-
- if ( Scr ) {
- CloseScreen( Scr );
- Scr = NULL;
- }
- }
-
- int HandlemgetIDCMP( void )
- {
- struct IntuiMessage *m;
- struct MenuItem *n;
- int (*func)();
- BOOL running = TRUE;
-
- while( m = GT_GetIMsg( mgetWnd->UserPort )) {
-
- CopyMem(( char * )m, ( char * )&mgetMsg, (long)sizeof( struct IntuiMessage ));
- lastcode = m->Code;
-
- GT_ReplyIMsg( m );
-
- switch ( mgetMsg.Class ) {
-
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh( mgetWnd );
- GT_EndRefresh( mgetWnd, TRUE );
- break;
-
- case IDCMP_CLOSEWINDOW:
- running = mgetCloseWindow();
- break;
-
- case IDCMP_GADGETUP:
- case IDCMP_GADGETDOWN:
- func = ( void * )(( struct Gadget * )mgetMsg.IAddress )->UserData;
- running = func();
- break;
-
- case IDCMP_MENUPICK:
- while( mgetMsg.Code != MENUNULL ) {
- n = ItemAddress( mgetMenus, mgetMsg.Code );
- func = (void *)(GTMENUITEM_USERDATA( n ));
- running = func();
- mgetMsg.Code = n->NextSelect;
- }
- break;
- }
- }
- return( running );
- }
-
- int OpenmgetWindow( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
-
- if ( ! ( g = CreateContext( &mgetGList )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < mget_CNT; lc++ ) {
-
- CopyMem((char * )&mgetNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- mgetGadgets[ lc ] = g = CreateGadgetA((ULONG)mgetGTypes[ lc ], g, &ng, ( struct TagItem * )&mgetGTags[ tc ] );
-
- while( mgetGTags[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
-
- if ( ! ( mgetMenus = CreateMenus( mgetNewMenu, GTMN_FrontPen, 0L, TAG_DONE )))
- return( 3L );
-
- LayoutMenus( mgetMenus, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE );
-
- if ( ! ( mgetWnd = OpenWindowTags( NULL,
- WA_Left, mgetLeft,
- WA_Top, mgetTop,
- WA_Width, mgetWidth,
- WA_Height, mgetHeight + offy,
- WA_IDCMP, LISTVIEWIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
- WA_Gadgets, mgetGList,
- WA_Title, mgetWdt,
- WA_ScreenTitle, "GadMGet V1.0",
- WA_CustomScreen, Scr,
- WA_MinWidth, 627,
- WA_MinHeight, 21,
- WA_MaxWidth, 682,
- WA_MaxHeight, 458,
- TAG_DONE )))
- return( 4L );
-
- SetMenuStrip( mgetWnd, mgetMenus );
- GT_RefreshWindow( mgetWnd, NULL );
-
- return( 0L );
- }
-
- void ClosemgetWindow( void )
- {
- if ( mgetMenus ) {
- ClearMenuStrip( mgetWnd );
- FreeMenus( mgetMenus );
- mgetMenus = NULL; }
-
- if ( mgetWnd ) {
- CloseWindow( mgetWnd );
- mgetWnd = NULL;
- }
-
- if ( mgetGList ) {
- FreeGadgets( mgetGList );
- mgetGList = NULL;
- }
- }
-
-
- #endif
-
-